<script setup>
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'
import { getBusinessDetail } from '@/api/index'
import { fixContentImageUrls } from '@/utils/fixImageUrls'

onLoad(({ id }) => {
  onGetBusinessDetail(id)
})

const businessDetail = ref({
  id: '',
  title: '',
  content: '',
})

async function onGetBusinessDetail(id) {
  const { result } = await getBusinessDetail(id)
  businessDetail.value = {
    ...result,
    content: fixContentImageUrls(result.content),
  }
}
</script>

<template>
  <view class="bg-[#F5F5F5] pb-safe min-h-safe">
    <nut-navbar title="酒店餐饮" custom-color="#000" left-show placeholder fixed />
    <view class="px-2 m-2 bg-white rounded">
      <view class="py-3">
        <rich-text :nodes="businessDetail.content" selectable />
      </view>
    </view>
  </view>
</template>
